# coding: utf-8
from application import db


class Goods(db.Model):
    __tablename__ = 't_goods'

    id = db.Column(db.BigInteger, primary_key=True, unique=True, comment='序号')
    name = db.Column(db.String(30), comment='物品名')
    details = db.Column(db.String(200), nullable=False, comment='物品详情')
    image = db.Column(db.String(60), nullable=False, unique=True, comment='主图')
    price = db.Column(db.Numeric(10, 2), nullable=False, comment='价格')
    classify = db.Column(db.BigInteger, comment='类别')
    sendType = db.Column(db.BigInteger, comment='配送方式')
    status = db.Column(db.Integer, nullable=False, comment='状态')
    useraddress = db.Column(db.String(50), nullable=False, unique=True, comment='持有人')
    itemIdCounter = db.Column(db.BigInteger, comment='链上id')
    blocknum = db.Column(db.Integer, comment='块高')
    blockHash = db.Column(db.String(200), unique=True, comment='块哈希')
    transactionhash = db.Column(db.String(200), unique=True, comment='交易哈希')
    created_time = db.Column(db.DateTime, nullable=False, comment='创建时间')
    updated_time = db.Column(db.DateTime, nullable=False, comment='更新时间')

    def __repr__(self):
        return '<Goods %r>' % self.name
